#pragma once

#include "Types.h"
#include <irrXML.h>
using namespace irr;
using namespace core;
using namespace io;

class CMemoryStream :
	public IFileReadCallBack
{
public:
	CMemoryStream(char *buffer, long size);
	CMemoryStream(char *fileName);
	~CMemoryStream(void);
	virtual int read(void* buffer, int sizeToRead);
	virtual long getSize() const;
	long getPosition() const;

	void setBuffer(char *buffer, long size);
	void setBufferFromFile(char *filename);

private:
	char *mBuffer;
	char *mPositionPointer;
	long mPosition;
	long mSize;
	bool selfAllocated;
};
